package cn.shyouchi.wuguanjia.android.ui.attendance;

import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;

import java.util.List;

import cn.shyouchi.wuguanjia.android.R;

/**
 * Created by Eenie on 2016/11/29 at 10:26
 * Email: 472279981@qq.com
 * Des:
 */

public class AttendanceModuleAdapter extends BaseQuickAdapter<AttendanceModuleEntity,BaseViewHolder> {


    private AttendanceContract.View mView;
    public AttendanceModuleAdapter( List<AttendanceModuleEntity> data,AttendanceContract.View view) {
        super(R.layout.item_attendance_module_layout, data);
        this.mView = view;
    }

    @Override
    protected void convert(BaseViewHolder holder, final AttendanceModuleEntity entity) {

        holder.setText(R.id.tv_module_name, entity.getName());
        holder.setImageResource(R.id.img_module_ico, entity.getIco_res());
        holder.itemView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {

                mView.onModuleClick(entity);

            }
        });
    }
}
